package org.vergil.core.designpattern.state.Lift;

/**
 * Created by vergil on 17-3-25.
 */
public class ClosingState extends LiftState {

    public ClosingState(LiftState state){
        this.context = state.context;
    }
    public ClosingState(){
    }

    //电梯门关闭，这是关闭状态要实现的动作
    @Override
    public void close() {
        context.setLiftState(Context.closingState);
        System.out.println("电梯门关闭...");
    }
    //电梯门关了再打开
    @Override
    public void open() {
        context.setLiftState(Context.openningState);
        context.getLiftState().open();
    }

    @Override
    public void run() {
        context.setLiftState(Context.runningState);
        context.getLiftState().run();
    }

    @Override
    public void stop() {
        context.setLiftState(Context.stoppingState);
        context.getLiftState().stop();
    }
}
